<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="companyDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='companyDetail.heading'/>"/>
</head>

<form:form commandName="company" method="post" action="/companyform/submit" id="companyForm" onsubmit="return validateCompany(this)">
<form:errors path="*" cssClass="error" element="div"/>
<form:hidden path="id"/>
<form:hidden path="userId"/>
<ul>
    <li>
        <appfuse:label styleClass="desc" key="company.discription"/>
        <form:errors path="discription" cssClass="fieldError"/>
        <form:input path="discription" id="discription" cssClass="text medium" cssErrorClass="text medium error" maxlength="300"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.email"/>
        <form:errors path="email" cssClass="fieldError"/>
        <form:input path="email" id="email" cssClass="text medium" cssErrorClass="text medium error" maxlength="30"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.fax"/>
        <form:errors path="fax" cssClass="fieldError"/>
        <form:input path="fax" id="fax" cssClass="text medium" cssErrorClass="text medium error" maxlength="20"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.location"/>
        <form:errors path="location" cssClass="fieldError"/>
        <form:input path="location" id="location" cssClass="text medium" cssErrorClass="text medium error" maxlength="60"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.name"/>
        <form:errors path="name" cssClass="fieldError"/>
        <form:input path="name" id="name" cssClass="text medium" cssErrorClass="text medium error" maxlength="60"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.phone"/>
        <form:errors path="phone" cssClass="fieldError"/>
        <form:input path="phone" id="phone" cssClass="text medium" cssErrorClass="text medium error" maxlength="40"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.productionTag"/>
        <form:errors path="productionTag" cssClass="fieldError"/>
        <form:input path="productionTag" id="productionTag" cssClass="text medium" cssErrorClass="text medium error" maxlength="100"/>
    </li>
    <li>
        <appfuse:label styleClass="desc" key="company.site"/>
        <form:errors path="site" cssClass="fieldError"/>
        <form:input path="site" id="site" cssClass="text medium" cssErrorClass="text medium error" maxlength="30"/>
    </li>

     <form:select path="type.id">
                <form:option value="0">--Please Select</form:option>
                <form:options items="${typeList}" itemValue="id" itemLabel="tag" />
     </form:select>

    <!-- todo: change this to read the identifier field from the other pojo -->
    <s:select name="company.type2.id" list="type2List" listKey="id" listValue="id"></s:select>
    <!-- todo: change this to read the identifier field from the other pojo -->
    <s:select name="company.type3.id" list="type3List" listKey="id" listValue="id"></s:select>

    <li class="buttonBar bottom">
        <input type="submit" class="button" name="save" value="<fmt:message key="button.save"/>"/>
        <c:if test="${not empty company.id}">
        <input type="submit" class="button" name="delete" onclick="bCancel=true;return confirmDelete('company')"
            value="<fmt:message key="button.delete"/>" />
        </c:if>
        <input type="submit" class="button" name="cancel" value="<fmt:message key="button.cancel"/>" onclick="bCancel=true"/>
    </li>
</ul>
</form:form>

<v:javascript formName="company" cdata="false" dynamicJavascript="true" staticJavascript="false"/>
<script type="text/javascript" src="<c:url value='/scripts/validator.jsp'/>"></script>

<script type="text/javascript">
    Form.focusFirstElement($('companyForm'));
</script>
